var number = 9;
var startingPage;
//获取传递过来的值
var url = decodeURI(window.location.href);
var aa = url.indexOf('=');
if (aa > -1) {
    url = url.substring(aa + 1);
}

//废品初始数据
function loadWebList() {
    startingPage = 0;
    var data = {
        "page": startingPage,
        "number": number,
        "compID": url
    };
    $.ajax({
        url: "findWebRecycleProductByRecycleProductListAndCompanyName",
        type: "POST",
        dataType: "json",
        data: JSON.stringify(data),
        contentType: 'application/json;charset=utf-8',
        success: function (data) {
            var code = ' ';
            if (data.code == 500) {
                Swal.fire("提示", "温馨提示：查询此类数据不存在", "error");
            } else {
                for (var i = 0; i < data.product_List.length; i++) {
                    code += " <div class=\"col-xl-4 col-md-6\">\n" +
                        "                                    <div class=\"product-grid-view\">\n" +
                        "                                        <div class=\"grid-view-layout2\">\n" +
                        "                                            <div class=\"product-box-layout1\">\n" +
                        "                                                <div class=\"item-img\">\n" +
                        "                                                    <a href=web-single-product.html?id=" + data.product_List[i].recProductID + " class=\"item-trending\"><img style='width: 275px;height: 195px;' src='upload/" + data.product_List[i].recProductImage + "' alt=\"Product\"></a>\n" +
                        "                                                </div>\n" +
                        "                                                <div class=\"item-content\">\n" +
                        "                                                    <div class=\"item-price\">\n" +
                        "                                                        <span class=\"currency-symbol\">$</span>\n" +
                        "                                                             " + data.product_List[i].recProductPrice + "<span>/</span>\n" +
                        "                               " + data.product_List[i].recProductUnit + " \n" +
                        "                                                    </div>\n" +
                        "                                                    <h3 class=\"item-title\"><a href=web-single-product.html?id=" + data.product_List[i].recProductID + ">" + data.product_List[i].recProductName + "</a><span>New</span></h3>\n" +
                        "                                                    <ul class=\"entry-meta\">\n" +
                        "                                                        <li><i class=\"far fa-clock\"></i>" + data.product_List[i].recProductDate + "</li>\n" +
                        "                                                        <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[i].companyEntity.compAddress + "</li>\n" +
                        "                                                    </ul>\n" +
                        "                                                </div>\n" +
                        "                                            </div>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <div class=\"product-list-view\">\n" +
                        "                                        <div class=\"list-view-layout2\">\n" +
                        "                                            <div class=\"product-box-layout3\">\n" +
                        "                                                <div class=\"item-img\">\n" +
                        "                                                    <a href=web-single-product.html?id=" + data.product_List[i].recProductID + " class=\"item-trending\"><img style='width: 275px;height: 195px;' src='upload/" + data.product_List[i].recProductImage + "' alt=\"Product\"></a>\n" +
                        "                                                </div>\n" +
                        "                                                <div class=\"product-info\">\n" +
                        "                                                    <div class=\"item-content\">\n" +
                        "                                                        <h3 class=\"item-title\"><a href=web-single-product.html?id=" + data.product_List[i].recProductID + ">" + data.product_List[i].recProductName + "</a><span>New</span></h3>\n" +
                        "                                                        <ul class=\"entry-meta\">\n" +
                        "                                                            <li><i class=\"far fa-clock\"></i>" + data.product_List[i].recProductDate + "</li>\n" +
                        "                                                            <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[i].companyEntity.compAddress + "</li>\n" +
                        "                                                        </ul>\n" +
                        "                                                        <p>" + data.product_List[i].recProductDetail + "</p>\n" +
                        "                                                    </div>\n" +
                        "                                                    <div class=\"item-right\">\n" +
                        "                                                        <div class=\"right-meta\">\n" +
                        "                                                         <span><i class=\"fas fa-shopping-cart\"></i>Sell</span> " +
                        "                                                               </div>\n" +
                        "                                                        <div class=\"item-price\">\n" +
                        "                                                            <span class=\"currency-symbol\">$</span>\n" +
                        "                                                             " + data.product_List[i].recProductPrice + "<span>/</span>\n" +
                        "                               " + data.product_List[i].recProductUnit + " \n" +
                        "                                                        </div>\n" +
                        "                                                        <div class=\"item-btn\">\n" +
                        "                                                            <a href=web-single-product.html?id=" + data.product_List[i].recProductID + ">废品详情</a>\n" +
                        "                                                        </div>\n" +
                        "                                                    </div>\n" +
                        "                                                </div>\n" +
                        "                                            </div>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                </div>";
                }
                var profile = data.product_List[0].companyEntity.compProfile.substr(0, 20);
                $("#CompanyDetail_1").html("");
                $("#CompanyDetail_2").html("");
                $("#loadWebList").html("");
                $("#myProjectTable").html("");
                $("#loadWebList").append(code);
                $("#pageNumber").val(data.count);
                $("#CompanyDetail_1").html(" <div class=\"store-logo\">\n" +
                    "                        <img src=\"user/media/figure/store10.png\"  alt=\"RadiusTheme\">\n" +
                    "                    </div>\n" +
                    "                    <div class=\"store-content\">\n" +
                    "                        <h2 class=\"item-title\">" + data.product_List[0].companyEntity.compName + "</h2>\n" +
                    "                        <ul class=\"item-meta\">\n" +
                    "                            <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[0].companyEntity.compAddress + "</li>\n" +
                    "                            <li><i class=\"fas fa-user\"></i>" + data.product_List[0].companyEntity.compDate + "</li>\n" +
                    "                        </ul>\n" +
                    "                    </div>");
                $("#CompanyDetail_2").html("  <div class=\"widget-lg widget-store-detail widget-light-bg\">\n" +
                    "                        <h3 class=\"widget-border-title\">公司简介</h3>\n" +
                    "                        <div class=\"store-content\">\n" +
                    "                            <p>" + data.product_List[0].companyEntity.compProfile.substr(0, 40) + "...</p>\n" +
                    "                        </div>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"widget-lg widget-author-info widget-store-info widget-light-bg\">\n" +
                    "                        <h3 class=\"widget-border-title\">公司信息</h3>\n" +
                    "                        <div class=\"author-content\">\n" +
                    "                            <div class=\"store-website\">\n" +
                    "                                <a href=\"https://www.radiustheme.com\"><i class=\"fas fa-globe-asia\"></i>Visit Website</a>\n" +
                    "                            </div>\n" +
                    "                            <div class=\"store-opening-hour\">\n" +
                    "                                <span class=\"item-title\"><i class=\"far fa-clock\"></i>上班时间</span>\n" +
                    "                                <ul>\n" +
                    "                                    <li><span>Sunday</span>Closed</li>\n" +
                    "                                    <li><span>Monday</span>1:00 PM - 1:00 PM</li>\n" +
                    "                                    <li><span>Tuesday</span>1:00 PM - 1:00 PM</li>\n" +
                    "                                    <li><span>Wednesday</span>Closed</li>\n" +
                    "                                    <li><span>Thursday</span>Closed</li>\n" +
                    "                                    <li><span>Friday</span>1:00 AM - 11:00 PM</li>\n" +
                    "                                    <li><span>Saturday</span>Closed</li>\n" +
                    "                                </ul>\n" +
                    "                            </div>\n" +
                    "                            <div class=\"phone-number classima-phone-reveal not-revealed\" data-phone=\"6735568568\">\n" +
                    "                                <div class=\"number\"><i class=\"fas fa-phone\"></i><span>" + data.product_List[0].companyEntity.compPhone + "</span></div>\n" +
                    "                                <div class=\"item-text\">Click to reveal phone number</div>\n" +
                    "                            </div>\n" +
                    "                            <div class=\"author-mail\">\n" +
                    "                                <a href=\"#\" class=\"mail-btn\" data-toggle=\"modal\" data-target=\"#author-mail\">\n" +
                    "                                    <i class=\"fas fa-envelope\"></i>" + data.product_List[0].companyEntity.compEmail + "\n" +
                    "                                </a>\n" +
                    "                            </div>\n" +
                    "                        </div>\n" +
                    "                    </div>");
                $("#myProjectTable").html("   <div class=\"btn-prev\">\n" +
                    "                            <a onclick='myProjectTable_previous()'><i class=\"fas fa-angle-double-left\"></i>Previous</a>\n" +
                    "                        </div>\n" +
                    "                        <div class=\"page-number\">\n" +
                    "                            <a href=\"#\" class=\"active\">" + (startingPage + 1) + "</a>\n" +
                    "                        </div>\n" +
                    "                        <div class=\"btn-next\">\n" +
                    "                            <a onclick='myProjectTable_next()'>Next<i class=\"fas fa-angle-double-right\"></i></a>\n" +
                    "                        </div>");
            }
        }
    });
}

//初始上一页
function myProjectTable_previous() {
    startingPage = startingPage - 1;
    if (startingPage < 0) {
        startingPage = 0;
        Swal.fire("提示", "数据不存在", "warning");
    } else {
        var data = {
            "page": startingPage,
            "number": number,
            "compID": url
        };
        $.ajax({
            url: "findWebRecycleProductByRecycleProductListAndCompanyName",
            type: "POST",
            dataType: "json",
            data: JSON.stringify(data),
            contentType: 'application/json;charset=utf-8',
            success: function (data) {
                var code = ' ';
                if (data.code == 500) {
                    Swal.fire("提示", "温馨提示：查询此类数据不存在", "error");
                } else {
                    for (var i = 0; i < data.product_List.length; i++) {
                        code += " <div class=\"col-xl-4 col-md-6\">\n" +
                            "                                    <div class=\"product-grid-view\">\n" +
                            "                                        <div class=\"grid-view-layout2\">\n" +
                            "                                            <div class=\"product-box-layout1\">\n" +
                            "                                                <div class=\"item-img\">\n" +
                            "                                                    <a href=web-user-product.html?id=" + data.product_List[i].recProductID + " class=\"item-trending\"><img style='width: 275px;height: 195px;' src='upload/" + data.product_List[i].recProductImage + "' alt=\"Product\"></a>\n" +
                            "                                                </div>\n" +
                            "                                                <div class=\"item-content\">\n" +
                            "                                                    <div class=\"item-price\">\n" +
                            "                                                        <span class=\"currency-symbol\">$</span>\n" +
                            "                                                             " + data.product_List[i].recProductPrice + "<span>/</span>\n" +
                            "                               " + data.product_List[i].recProductUnit + " \n" +
                            "                                                    </div>\n" +
                            "                                                    <h3 class=\"item-title\"><a href=web-user-product.html?id=" + data.product_List[i].recProductID + ">" + data.product_List[i].recProductName + "</a><span>New</span></h3>\n" +
                            "                                                    <ul class=\"entry-meta\">\n" +
                            "                                                        <li><i class=\"far fa-clock\"></i>" + data.product_List[i].recProductDate + "</li>\n" +
                            "                                                        <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[i].companyEntity.compAddress + "</li>\n" +
                            "                                                    </ul>\n" +
                            "                                                </div>\n" +
                            "                                            </div>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <div class=\"product-list-view\">\n" +
                            "                                        <div class=\"list-view-layout2\">\n" +
                            "                                            <div class=\"product-box-layout3\">\n" +
                            "                                                <div class=\"item-img\">\n" +
                            "                                                    <a href=web-user-product.html?id=" + data.product_List[i].recProductID + " class=\"item-trending\"><img style='width: 275px;height: 195px;' src='upload/" + data.product_List[i].recProductImage + "' alt=\"Product\"></a>\n" +
                            "                                                </div>\n" +
                            "                                                <div class=\"product-info\">\n" +
                            "                                                    <div class=\"item-content\">\n" +
                            "                                                        <h3 class=\"item-title\"><a href=web-user-product.html?id=" + data.product_List[i].recProductID + ">" + data.product_List[i].recProductName + "</a><span>New</span></h3>\n" +
                            "                                                        <ul class=\"entry-meta\">\n" +
                            "                                                            <li><i class=\"far fa-clock\"></i>" + data.product_List[i].recProductDate + "</li>\n" +
                            "                                                            <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[i].companyEntity.compAddress + "</li>\n" +
                            "                                                        </ul>\n" +
                            "                                                        <p>" + data.product_List[i].recProductDetail + "</p>\n" +
                            "                                                    </div>\n" +
                            "                                                    <div class=\"item-right\">\n" +
                            "                                                        <div class=\"right-meta\">\n" +
                            "                                                         <span><i class=\"fas fa-shopping-cart\"></i>Sell</span> " +
                            "                                                               </div>\n" +
                            "                                                        <div class=\"item-price\">\n" +
                            "                                                            <span class=\"currency-symbol\">$</span>\n" +
                            "                                                             " + data.product_List[i].recProductPrice + "<span>/</span>\n" +
                            "                               " + data.product_List[i].recProductUnit + " \n" +
                            "                                                        </div>\n" +
                            "                                                        <div class=\"item-btn\">\n" +
                            "                                                            <a href=web-single-product.html?id=" + data.product_List[i].recProductID + ">废品详情</a>\n" +
                            "                                                        </div>\n" +
                            "                                                    </div>\n" +
                            "                                                </div>\n" +
                            "                                            </div>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                </div>";
                    }
                    var profile = data.product_List[0].companyEntity.compProfile.substr(0, 20);
                    $("#CompanyDetail_1").html("");
                    $("#CompanyDetail_2").html("");
                    $("#loadWebList").html("");
                    $("#myProjectTable").html("");
                    $("#loadWebList").append(code);
                    $("#pageNumber").val(data.count);
                    $("#CompanyDetail_1").html(" <div class=\"store-logo\">\n" +
                        "                        <img src=\"user/media/figure/store10.png\"  alt=\"RadiusTheme\">\n" +
                        "                    </div>\n" +
                        "                    <div class=\"store-content\">\n" +
                        "                        <h2 class=\"item-title\">" + data.product_List[0].companyEntity.compName + "</h2>\n" +
                        "                        <ul class=\"item-meta\">\n" +
                        "                            <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[0].companyEntity.compAddress + "</li>\n" +
                        "                            <li><i class=\"fas fa-user\"></i>" + data.product_List[0].companyEntity.compDate + "</li>\n" +
                        "                        </ul>\n" +
                        "                    </div>");
                    $("#CompanyDetail_2").html("  <div class=\"widget-lg widget-store-detail widget-light-bg\">\n" +
                        "                        <h3 class=\"widget-border-title\">公司简介</h3>\n" +
                        "                        <div class=\"store-content\">\n" +
                        "                            <p>" + data.product_List[0].companyEntity.compProfile.substr(0, 40) + "...</p>\n" +
                        "                        </div>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"widget-lg widget-author-info widget-store-info widget-light-bg\">\n" +
                        "                        <h3 class=\"widget-border-title\">公司信息</h3>\n" +
                        "                        <div class=\"author-content\">\n" +
                        "                            <div class=\"store-website\">\n" +
                        "                                <a href=\"https://www.radiustheme.com\"><i class=\"fas fa-globe-asia\"></i>Visit Website</a>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"store-opening-hour\">\n" +
                        "                                <span class=\"item-title\"><i class=\"far fa-clock\"></i>上班时间</span>\n" +
                        "                                <ul>\n" +
                        "                                    <li><span>Sunday</span>Closed</li>\n" +
                        "                                    <li><span>Monday</span>1:00 PM - 1:00 PM</li>\n" +
                        "                                    <li><span>Tuesday</span>1:00 PM - 1:00 PM</li>\n" +
                        "                                    <li><span>Wednesday</span>Closed</li>\n" +
                        "                                    <li><span>Thursday</span>Closed</li>\n" +
                        "                                    <li><span>Friday</span>1:00 AM - 11:00 PM</li>\n" +
                        "                                    <li><span>Saturday</span>Closed</li>\n" +
                        "                                </ul>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"phone-number classima-phone-reveal not-revealed\" data-phone=\"6735568568\">\n" +
                        "                                <div class=\"number\"><i class=\"fas fa-phone\"></i><span>" + data.product_List[0].companyEntity.compPhone + "</span></div>\n" +
                        "                                <div class=\"item-text\">Click to reveal phone number</div>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"author-mail\">\n" +
                        "                                <a href=\"#\" class=\"mail-btn\" data-toggle=\"modal\" data-target=\"#author-mail\">\n" +
                        "                                    <i class=\"fas fa-envelope\"></i>" + data.product_List[0].companyEntity.compEmail + "\n" +
                        "                                </a>\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                    </div>");
                    $("#myProjectTable").html("   <div class=\"btn-prev\">\n" +
                        "                            <a onclick='myProjectTable_previous()'><i class=\"fas fa-angle-double-left\"></i>Previous</a>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"page-number\">\n" +
                        "                            <a href=\"#\" class=\"active\">" + (startingPage + 1) + "</a>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"btn-next\">\n" +
                        "                            <a onclick='myProjectTable_next()'>Next<i class=\"fas fa-angle-double-right\"></i></a>\n" +
                        "                        </div>");
                }
            }
        });
    }
}

//初始下一页
function myProjectTable_next() {
    startingPage = startingPage + 1;
    var startingPageNumber = startingPage * number;
    var numberSum = $("#pageNumber").val();
    if (startingPageNumber >= numberSum && (startingPageNumber - number) <= numberSum) {
        Swal.fire("提示", "数据浏览已到底", "warning");
    } else {
        var data = {
            "page": startingPage,
            "number": number,
            "compID": url
        };
        $.ajax({
            url: "findWebRecycleProductByRecycleProductListAndCompanyName",
            type: "POST",
            dataType: "json",
            data: JSON.stringify(data),
            contentType: 'application/json;charset=utf-8',
            success: function (data) {
                var code = ' ';
                if (data.code == 500) {
                    Swal.fire("提示", "温馨提示：查询此类数据不存在", "error");
                } else {
                    for (var i = 0; i < data.product_List.length; i++) {
                        code += " <div class=\"col-xl-4 col-md-6\">\n" +
                            "                                    <div class=\"product-grid-view\">\n" +
                            "                                        <div class=\"grid-view-layout2\">\n" +
                            "                                            <div class=\"product-box-layout1\">\n" +
                            "                                                <div class=\"item-img\">\n" +
                            "                                                    <a href=web-user-product.html?id=" + data.product_List[i].recProductID + " class=\"item-trending\"><img style='width: 275px;height: 195px;' src='upload/" + data.product_List[i].recProductImage + "' alt=\"Product\"></a>\n" +
                            "                                                </div>\n" +
                            "                                                <div class=\"item-content\">\n" +
                            "                                                    <div class=\"item-price\">\n" +
                            "                                                        <span class=\"currency-symbol\">$</span>\n" +
                            "                                                             " + data.product_List[i].recProductPrice + "<span>/</span>\n" +
                            "                               " + data.product_List[i].recProductUnit + " \n" +
                            "                                                    </div>\n" +
                            "                                                    <h3 class=\"item-title\"><a href=web-user-product.html?id=" + data.product_List[i].recProductID + ">" + data.product_List[i].recProductName + "</a><span>New</span></h3>\n" +
                            "                                                    <ul class=\"entry-meta\">\n" +
                            "                                                        <li><i class=\"far fa-clock\"></i>" + data.product_List[i].recProductDate + "</li>\n" +
                            "                                                        <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[i].companyEntity.compAddress + "</li>\n" +
                            "                                                    </ul>\n" +
                            "                                                </div>\n" +
                            "                                            </div>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <div class=\"product-list-view\">\n" +
                            "                                        <div class=\"list-view-layout2\">\n" +
                            "                                            <div class=\"product-box-layout3\">\n" +
                            "                                                <div class=\"item-img\">\n" +
                            "                                                    <a href=web-user-product.html?id=" + data.product_List[i].recProductID + " class=\"item-trending\"><img style='width: 275px;height: 195px;' src='upload/" + data.product_List[i].recProductImage + "' alt=\"Product\"></a>\n" +
                            "                                                </div>\n" +
                            "                                                <div class=\"product-info\">\n" +
                            "                                                    <div class=\"item-content\">\n" +
                            "                                                        <h3 class=\"item-title\"><a href=web-user-product.html?id=" + data.product_List[i].recProductID + ">" + data.product_List[i].recProductName + "</a><span>New</span></h3>\n" +
                            "                                                        <ul class=\"entry-meta\">\n" +
                            "                                                            <li><i class=\"far fa-clock\"></i>" + data.product_List[i].recProductDate + "</li>\n" +
                            "                                                            <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[i].companyEntity.compAddress + "</li>\n" +
                            "                                                        </ul>\n" +
                            "                                                        <p>" + data.product_List[i].recProductDetail + "</p>\n" +
                            "                                                    </div>\n" +
                            "                                                    <div class=\"item-right\">\n" +
                            "                                                        <div class=\"right-meta\">\n" +
                            "                                                         <span><i class=\"fas fa-shopping-cart\"></i>Sell</span> " +
                            "                                                               </div>\n" +
                            "                                                        <div class=\"item-price\">\n" +
                            "                                                            <span class=\"currency-symbol\">$</span>\n" +
                            "                                                             " + data.product_List[i].recProductPrice + "<span>/</span>\n" +
                            "                               " + data.product_List[i].recProductUnit + " \n" +
                            "                                                        </div>\n" +
                            "                                                        <div class=\"item-btn\">\n" +
                            "                                                            <a href=web-single-product.html?id=" + data.product_List[i].recProductID + ">废品详情</a>\n" +
                            "                                                        </div>\n" +
                            "                                                    </div>\n" +
                            "                                                </div>\n" +
                            "                                            </div>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                </div>";
                    }
                    var profile = data.product_List[0].companyEntity.compProfile.substr(0, 20);
                    $("#CompanyDetail_1").html("");
                    $("#CompanyDetail_2").html("");
                    $("#loadWebList").html("");
                    $("#myProjectTable").html("");
                    $("#loadWebList").append(code);
                    $("#pageNumber").val(data.count);
                    $("#CompanyDetail_1").html(" <div class=\"store-logo\">\n" +
                        "                        <img src=\"user/media/figure/store10.png\"  alt=\"RadiusTheme\">\n" +
                        "                    </div>\n" +
                        "                    <div class=\"store-content\">\n" +
                        "                        <h2 class=\"item-title\">" + data.product_List[0].companyEntity.compName + "</h2>\n" +
                        "                        <ul class=\"item-meta\">\n" +
                        "                            <li><i class=\"fas fa-map-marker-alt\"></i>" + data.product_List[0].companyEntity.compAddress + "</li>\n" +
                        "                            <li><i class=\"fas fa-user\"></i>" + data.product_List[0].companyEntity.compDate + "</li>\n" +
                        "                        </ul>\n" +
                        "                    </div>");
                    $("#CompanyDetail_2").html("  <div class=\"widget-lg widget-store-detail widget-light-bg\">\n" +
                        "                        <h3 class=\"widget-border-title\">公司简介</h3>\n" +
                        "                        <div class=\"store-content\">\n" +
                        "                            <p>" + data.product_List[0].companyEntity.compProfile.substr(0, 40) + "...</p>\n" +
                        "                        </div>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"widget-lg widget-author-info widget-store-info widget-light-bg\">\n" +
                        "                        <h3 class=\"widget-border-title\">公司信息</h3>\n" +
                        "                        <div class=\"author-content\">\n" +
                        "                            <div class=\"store-website\">\n" +
                        "                                <a href=\"https://www.radiustheme.com\"><i class=\"fas fa-globe-asia\"></i>Visit Website</a>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"store-opening-hour\">\n" +
                        "                                <span class=\"item-title\"><i class=\"far fa-clock\"></i>上班时间</span>\n" +
                        "                                <ul>\n" +
                        "                                    <li><span>Sunday</span>Closed</li>\n" +
                        "                                    <li><span>Monday</span>1:00 PM - 1:00 PM</li>\n" +
                        "                                    <li><span>Tuesday</span>1:00 PM - 1:00 PM</li>\n" +
                        "                                    <li><span>Wednesday</span>Closed</li>\n" +
                        "                                    <li><span>Thursday</span>Closed</li>\n" +
                        "                                    <li><span>Friday</span>1:00 AM - 11:00 PM</li>\n" +
                        "                                    <li><span>Saturday</span>Closed</li>\n" +
                        "                                </ul>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"phone-number classima-phone-reveal not-revealed\" data-phone=\"6735568568\">\n" +
                        "                                <div class=\"number\"><i class=\"fas fa-phone\"></i><span>" + data.product_List[0].companyEntity.compPhone + "</span></div>\n" +
                        "                                <div class=\"item-text\">Click to reveal phone number</div>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"author-mail\">\n" +
                        "                                <a href=\"#\" class=\"mail-btn\" data-toggle=\"modal\" data-target=\"#author-mail\">\n" +
                        "                                    <i class=\"fas fa-envelope\"></i>" + data.product_List[0].companyEntity.compEmail + "\n" +
                        "                                </a>\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                    </div>");
                    $("#myProjectTable").html("   <div class=\"btn-prev\">\n" +
                        "                            <a onclick='myProjectTable_previous()'><i class=\"fas fa-angle-double-left\"></i>Previous</a>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"page-number\">\n" +
                        "                            <a href=\"#\" class=\"active\">" + (startingPage + 1) + "</a>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"btn-next\">\n" +
                        "                            <a onclick='myProjectTable_next()'>Next<i class=\"fas fa-angle-double-right\"></i></a>\n" +
                        "                        </div>");
                }
            }
        });
    }
}

var score = 5;

//评分
function starLoad() {
    ul = document.getElementById('star');
    lis = ul.getElementsByTagName('li');
    for (var i = 0; i < lis.length; i++) {
        lis[i].onclick = function () {
            //被用户点击后弹框并提示分数
            //获取当前对象的对象名
            var className = this.className;//nostart
            //重新定义class,并弹出评分
            ul.className = "nostar " + className;
            score = this.getElementsByTagName('a')[0].title;
        }
    }
}

function submitData() {
    var plaintName = $("#plaintName").val();
    var plaintConter = $("#plaintConter").val();
    var data = {
        "plaintName": plaintName,
        "plaintConter": plaintConter,
        "plaintGrade": score,
        "compID": url
    };
    $.ajax({
        url: "insertPlaintByPlaintData",
        type: "POST",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        data: JSON.stringify(data),
        async: false,
        success: function (data) {
            if (data.code == 200) {
                Swal.fire("提示", "新增数据成功", "success");
            } else {
                Swal.fire("提示", "新增数据失败", "error");
            }
        }
    });
}

$(function () {
    var DATA = '';
    var data_1 = '';
    $.ajax({
        url: "JudgeLogin_4",
        type: "POST",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        success: function (data) {
            if (data.code == 500) {
                DATA += " <li class=\"header-btn\">\n" +
                    "                                    <a href=\"web-login.html\" class=\"item-btn\"><i class=\"fas fa-plus\"></i>登录</a>\n" +
                    "                                </li>"
            } else {
                DATA += " <li class=\"header-login-icon\">\n" +
                    "                                    <a href=\"web-account.html\" class=\"color-light\" data-toggle=\"tooltip\"\n" +
                    "                                       data-placement=\"top\" title=\"Login/Register\">\n" +
                    "                                        <i class=\"far fa-user\">我的</i>\n" +
                    "                                    </a>\n" +
                    "                                </li>\n" +
                    "                                <li class=\"header-btn\">\n" +
                    "                                    <a  onclick='tuichu()' class=\"item-btn\"><i class=\"fas fa-plus\"></i>退出</a>\n" +
                    "                                </li>";
                data_1 += " <button type=\"submit\" class=\"item-btn\" onclick=\"submitData()\">\n" +
                    "                                        提交\n" +
                    "                                    </button>";
            }
            $("#userData").html("");
            $("#userData").append(DATA);
            $("#data_1").html("");
            $("#data_1").append(data_1);
        }
    });
    loadWebList();
    starLoad();
});